<!--<link rel="stylesheet" href="https://file.viplgw.cn/ui/sat/cn/css/bootstrap.min.css">-->
<script src="https://file.viplgw.cn/ui/sat/cn/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="/css/coreCss/pagination.css">
<style>
    .addBtn{
        text-decoration: none;
        background: #337ab7;
        color: white;
        padding: 5px 10px;
        border-radius: 4px;
        margin-bottom:10px;
        display: inline-block;
    }
    .info-wrap>td {
        text-align: center;
        padding-top: 10px;
    }
    .info-wrap>td>div {
        max-height: 200px;
        overflow-y: auto;
    }
    .link-update{
        text-decoration: none;
        background: #337ab7;
        color: white;
        padding: 5px 10px;
        border-radius: 4px;
        margin-bottom: 10px;
        display: inline-block;
    }
    .link-update:hover{
        text-decoration: none;
        color: white;
        background: #286090;
    }
    .link-del{
        text-decoration: none;
        background: red;
        color: white;
        padding: 5px 10px;
        border-radius: 4px;
        margin-bottom: 10px;
        display: inline-block;
    }
    .link-del:hover{
        text-decoration: none;
        background: red;
        color: white;
    }
    .info-wrap{
        border-bottom: 1px solid #cccccc;
    }
    .tiao-wrap{
        display: flex;
        align-items: center;
    }
    .tiao-val{
        width: 42px;
        height: 24px;
        text-align: center;
        line-height: 24px;
        margin: 0 10px 0 0!important;
    }
    .tiao-btn{
        background: #286090!important;
        color: white!important;
        border: 1px solid #286090!important;
        border-radius: 3px;
    }
    #infoTable tr th {
        text-align: center;
    }
</style>
<div class="span10">
    <div style="margin-bottom: 20px">
        <a href="/index/index">首页</a>
        <span >&gt;</span>
        <span>热门活动管理</span>
    </div>
    <a class="addBtn" href="<?php echo baseUrl.'/content/hot-active/add'?>">添加活动</a>

    <form action="<?php echo baseUrl ?>/content/hot-active/index" method="get" class="form-horizontal">
        <table class="table">
            <tr>
                <td>
                    选择类别：
                </td>
                <td>
                    <select name="cate" id="cate" >
                        <option value="">请选择班级</option>
                        <option value="1" <?php echo isset($_GET['cate']) && $_GET['cate'] == "1" ? 'selected' : '' ?>>公开课</option>
                        <option value="2" <?php echo isset($_GET['cate']) && $_GET['cate'] == "2" ? 'selected' : '' ?>>训练营</option>
                        <option value="3" <?php echo isset($_GET['cate']) && $_GET['cate'] == "3" ? 'selected' : '' ?>>免费试听</option>
                        <option value="4" <?php echo isset($_GET['cate']) && $_GET['cate'] == "4" ? 'selected' : '' ?>>抽奖活动</option>

                    </select>
                </td>
                <td>
                    <button class="btn btn-primary" type="submit">提交</button>
                </td>
            </tr>

        </table>
    </form>

    <form action="/content/api/sort" method="post">
        <table border="0" rules="0" width="100%" id="infoTable">
            <tr align="center">
                <th width="5%">排序</th>
                <th width="5%">id</th>
                <th width="15%">活动名称</th>
                <th width="20%">封面图片</th>
                <th width="10%">开始时间</th>
                <th width="10%">结束时间</th>
                <th width="10%">浏览量</th>
                <th width="20%">操作</th>
            </tr>
            <?php
            foreach ($data as $v) {
                ?>
                <tr class="info-wrap">
                    <td>
                        <input style="width: 30px;" name="sort[]" type="text" value="<?php echo $v['sort'] ?>">
                        <input name="id[]" type="hidden" value="<?php echo $v['id'] ?>">
                    </td>
                    <td>
                        <?php echo $v['id'] ?>
                    </td>
                    <td><?php echo $v['title'] ?></td>
                    <td><?php echo $v['pic'] ?></td>
                    <td><?php echo $v['startTime'] ?></td>
                    <td><?php echo $v['endTime'] ?></td>
                    <td><?php echo $v['viewCount'] ?></td>
                    <td>
                        <a class="link-update"
                           href="<?php echo baseUrl . '/content/hot-active/add' . '?' . 'id=' . $v['id'] ?>">修改</a>
                        <a class="link-del" href="" onclick="del(<?php echo $v['id'] ?>)">删除</a>
                    </td>
                </tr>
            <?php } ?>
        </table>
        <input type="hidden" name="cate" value="8">
        <button class="push btn btn-primary" type="submit">排序</button>
    </form>

    <div class="tiao-wrap">
        <?php echo $str?>
        <div style="margin-left: 30px;">
            <input type="text" class="tiao-val"><button class="tiao-btn">跳转</button>
        </div>
    </div>
</div>
<script>
        function del(id){
            if(confirm("确定删除内容吗")) {
                $.get("/content/hot-active/del", {id: id},
                    function (msg) {
                        if (msg) {
                            alert('删除成功');
                        }
                    }, 'text'
                );
            }
        }
</script>
